| 
  | 
Turns out POV-Ray 3.5 misinterprets the
TIFFReadRGBAImage function in libtiff.
It assumes that returned scanlines are
topdown when in fact they are bottom up.
This causes 24-bit TIFF imagemaps to appear
vertically flipped.
The code fragment in tiff_pov.cpp, in function
Read_Tiff_Image(), near line 235 is currently:
   Image->data.rgb8_lines[i].blue   = (unsigned char
*)POV_MALLOC(width,"TIFF Image line");
   Image->data.rgb8_lines[i].green  = (unsigned char
*)POV_MALLOC(width,"TIFF Image line");
   Image->data.rgb8_lines[i].red    = (unsigned char
*)POV_MALLOC(width,"TIFF Image line");
   Image->data.rgb8_lines[i].transm = (unsigned char
*)POV_MALLOC(width,"TIFF Image line");
   for (j=0,l=0;j<width;j++)
   {
    Image->data.rgb8_lines[i].blue[j]   = (unsigned char)TIFFGetB(abgr);
    Image->data.rgb8_lines[i].green[j]  = (unsigned char)TIFFGetG(abgr);
    Image->data.rgb8_lines[i].red[j]    = (unsigned char)TIFFGetR(abgr);
    Image->data.rgb8_lines[i].transm[j] = 255 - (unsigned
char)TIFFGetA(abgr);
It should read:
   int n = (height-1)-i;
   Image->data.rgb8_lines[n].blue   = (unsigned char *)POV_MALLOC(width,
"TIFF Image line");
   Image->data.rgb8_lines[n].green  = (unsigned char *)POV_MALLOC(width,
"TIFF Image line");
   Image->data.rgb8_lines[n].red    = (unsigned char *)POV_MALLOC(width,
"TIFF Image line");
   Image->data.rgb8_lines[n].transm = (unsigned char *)POV_MALLOC(width,
"TIFF Image line");
   for (j=0,l=0;j<width;j++)
   {
    Image->data.rgb8_lines[n].blue[j]   = (unsigned char)TIFFGetB(abgr);
    Image->data.rgb8_lines[n].green[j]  = (unsigned char)TIFFGetG(abgr);
    Image->data.rgb8_lines[n].red[j]    = (unsigned char)TIFFGetR(abgr);
    Image->data.rgb8_lines[n].transm[j] = 255 - (unsigned
char)TIFFGetA(abgr);
--
Ray Gardener
Daylon Graphics Ltd.
"Heightfield modeling perfected"
 Post a reply to this message 
 | 
  |